<?php

defined( 'IN_DICE' ) or die( 'Access Error!' );

unset($_ENV, $HTTP_GET_VARS, $HTTP_POST_VARS, $HTTP_COOKIE_VARS, $HTTP_SERVER_VARS, $HTTP_ENV_VARS);

define( 'PRODUCT_ENV', false ); //产品所处环境, true为线上生产环境,false为测试环境

$cfg['testapp'] = 1; //1为测试应用,0为正式应用
$cfg['master'] = 1; //1为主web
$cfg['area'] = 0; //游戏地区:0大陆 1港澳台

define( 'DIR_CFG', DIR_ROOT . 'cfg/' ); //配置文件目录
define( 'DIR_DAT', DIR_ROOT . 'data/' ); //可写目录
define( 'DIR_LIB', DIR_ROOT . 'lib/' ); //库目录
define( 'DIR_MDL', DIR_ROOT . 'model/' ); //模型目录
define( 'DIR_VIEW', DIR_ROOT . 'view/' ); //视图目录
define( 'DIR_CTL', DIR_ROOT . 'control/' ); //控制器目录

PRODUCT_ENV === true ? error_reporting( 0 ) : error_reporting( E_ALL );
set_magic_quotes_runtime( 0 );

$cfg['db'] = array( //DB配置 (IP,用户,密码,数据库名)
  'user' => array(    'host' => '192.168.0.109:3388', 'user' => 'mysqlpp_test', 'pwd' => '123456', 'dbname' => 'dna' ),//用户
  'offline' => array( 'host' => '192.168.0.5:3388', 'user' => 'dicephp', 'pwd' => 'dicephp', 'dbname' => 'nb_offline' ),//离线
  'log' => array(    'host' => '192.168.0.109:3388', 'user' => 'mysqlpp_test', 'pwd' => '123456', 'dbname' => 'dna_log' ),//日志
  'friend' => array(  'host' => '192.168.0.5:3388', 'user' => 'dicephp', 'pwd' => 'dicephp', 'dbname' => 'nb_friends' ),//好友
  'apppay' => array(  'host' => '192.168.0.5:3388', 'user' => 'dicephp', 'pwd' => 'dicephp', 'dbname' => 'nb_apppay' ),//app支付
  'gift' => array(  'host' => '192.168.0.5:3388', 'user' => 'dicephp', 'pwd' => 'dicephp', 'dbname' => 'nb_gift' ),//礼物
  'count' => array(  'host' => '192.168.0.5:3388', 'user' => 'dicephp', 'pwd' => 'dicephp', 'dbname' => 'nb_count' ),//统计
);

$cfg['mcache'] = array( //Memcache配置
  'user' => array( '192.168.0.5', 11211 ), //用户,需要端口散列时可将 user 再分一级数组,在TT和memcache的制造函数中自动判断
  'friend' => array( '192.168.0.5', 11211 ), //好友
  'log' => array( '192.168.0.5', 11211 ), //日志与动态
  'db' => array( '192.168.0.5', 11211 ), //DB缓存
  'stat' => array( '192.168.0.5', 11211 ), //统计
  'table' => array( '192.168.0.5', 11211 ), //桌子与server
  'online' => array( '192.168.0.5', 11211 ), //在线与limit限制
  'event' => array( '192.168.0.5', 11211 ), //活动专用
);

$cfg['mredis'] = array( //Redis配置
  'default' => array( '192.168.0.5', 6699 ), //公有
  'log' => array( '192.168.0.5', 6699 ), //日志与动态
  'user' => array( '192.168.0.5', 6699 ), //用户,需要端口散列时可将 user 再分一级数组,在制造函数中会自动判断
  'friend' => array( '192.168.0.5', 6699 ), //好友
  'event' => array( '192.168.0.5', 6699 ), //活动
);

$cfg['tt'] = array( //TT配置
  'default' => array( '192.168.0.5', 19999 ), //公有TT
  'user' => array( '192.168.0.5', 19999 ), //用户
  'friend' => array( '192.168.0.5', 19999 ), //好友
  'event' => array( '192.168.0.5', 19999 ), //活动
);

$aOut = array(); //smarty的全局输出数组
$aOut['baseurl'] = 'http://' . $_SERVER['HTTP_HOST'] . '/douniu/'; //根URL
$aOut['imgurl'] = $aOut['baseurl'] . 'view/images/';
$aOut['viewurl'] = $aOut['baseurl'] . 'view/';
$aOut['payurl'] = $aOut['baseurl'] . 'pay.php'; //支付中心的根地址

$cfg['apppay'] = array( //支付中心app配置信息
  'appid' => 2, //支付appid
  'appsecret' => 'fdmjfdjsklafj4829jgesjoi4893fjdksla8', //支付密钥
  'returl' => '', //支付返回地址
  //'' => '',
);

//加载其它配置文件
include DIR_CFG . 'cfg.game.php';
include DIR_CFG . 'cfg.ver.php';
include DIR_CFG . 'cfg.platform.php';
include DIR_CFG . 'cfg.tool.php';
include DIR_CFG . 'cfg.admin.php';
include DIR_CFG . 'cfg.pay.php';
